@using Abc.Core;
@using Abc.Application;
@model Abc.Application.DataConfigOut;
@{
	ViewData["Title"] = "DataConfigInfo";
}

<section class="panel panel-padding">
 <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">

  <form class="layui-form" action="">
   <input type="hidden" asp-for="@ViewData["PKey"]" />
   <input type="hidden" asp-for="Id" />

   <div class="layui-bg-gray" style="padding: 30px;">
	<div class="layui-row layui-col-space15">
	 <div class="layui-col-md6">
	  <div class="layui-panel">
	   <div style="padding: 50px 30px;">
		<div class="layui-form-item">
		 <label class="layui-form-label">上级(PKey)</label>
		 <div class="layui-input-block">
		  <ul id="PKey" class="dtree" data-id="" data-value="@Model?.PKey"></ul>
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">关键词(Key)</label>
		 <div class="layui-input-block">
		  <input asp-for="Key" lay-verify="Key" autocomplete="off" placeholder="请输入关键词" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">名称</label>
		 <div class="layui-input-block">
		  <input asp-for="Name" lay-verify="Name" autocomplete="off" placeholder="请输入名称" class="layui-input">
		 </div>
		</div>
		<div class="layui-form-item">
		 <label class="layui-form-label">分组</label>
		 <div class="layui-input-block">
		  <input asp-for="GroupName" lay-verify="GroupName" autocomplete="off" placeholder="请输入分组" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">排序</label>
		 <div class="layui-input-block">
		  <input asp-for="Sort" lay-verify="Sort" autocomplete="off" placeholder="请输入排序" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">是否启用</label>
		 <div class="layui-input-block">
										@*<input type="checkbox" asp-for="IsEnable" lay-skin="primary" title="" checked="">
											<input type="checkbox" name="like[read]" title="阅读" checked="">*@
		  <input type="checkbox" asp-for="IsEnable" lay-skin="switch" lay-text="开|关" checked>
		 </div>
		</div>
	   </div>
	  </div>
	 </div>
	 <div class="layui-col-md6">
	  <div class="layui-panel">
	   <div style="padding: 50px 30px;">
		<div class="layui-form-item">
		 <label class="layui-form-label">值</label>
		 <div class="layui-input-block">
		  <input asp-for="Value" lay-verify="Value" autocomplete="off" placeholder="请输入值" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">值2</label>
		 <div class="layui-input-block">
		  <input asp-for="Value2" lay-verify="Value2" autocomplete="off" placeholder="请输入值2" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">值3</label>
		 <div class="layui-input-block">
		  <input asp-for="Value3" lay-verify="Value3" autocomplete="off" placeholder="请输入值3" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">值4</label>
		 <div class="layui-input-block">
		  <input asp-for="Value4" lay-verify="Value4" autocomplete="off" placeholder="请输入值4" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">值5</label>
		 <div class="layui-input-block">
		  <input asp-for="Value5" lay-verify="Value5" autocomplete="off" placeholder="请输入值5" class="layui-input">
		 </div>
		</div>
		<div class="layui-form-item">
		 <label class="layui-form-label">备注</label>
		 <div class="layui-input-block">
		  <input asp-for="Remark" lay-verify="Remark" autocomplete="off" placeholder="请输入备注" class="layui-input">
		 </div>
		</div>

		<div class="layui-form-item">
		 <label class="layui-form-label">扩展参数</label>
		 <div class="layui-input-block">
		  <input asp-for="ExtensionData" lay-verify="ExtensionData" autocomplete="off" placeholder="请输入扩展参数" class="layui-input">
		 </div>
		</div>
	   </div>
	  </div>
	 </div>
	</div>
   </div>

   <div class="layui-form-item">
	<div class="layui-input-block">
	 <div class="layui-btn submitbtn" lay-submit lay-filter="submit">提交数据</div>
	 <div class="layui-btn layui-btn-danger closewindow">关闭窗口</div>
	 <div class="layui-btn layui-btn-danger refreshwindow">重新加载</div>
	</div>
   </div>
  </form>
 </div>
</section>

@*<script src="~/lib/ckeditor4/ckeditor.js"></script>*@
@section Scripts{
<script>
	layui.define(['dtree', 'element',  'jquery', 'form'], function () {
		var $ = layui.jquery;
		var form = layui.form;
		var element = layui.element;
		var dtree = layui.dtree;

		//Info 初始化
		abc.infoInit();
		//提交
		form.on('submit(submit)', function (obj) {
			//obj.field.IsEnable=$('#IsEnable').is(':checked');
			//obj.field.Remark = Remark.getContent();
			obj.field.PKey = dtree.getNowParam("PKey").nodeId;
			abc.post({ url: '@(Url.Action("Edit"))', data: obj.field});

			return false;
		});

		dtree.renderSelect({
			elem: "#PKey",
				url: "@Url.Action("GetDcTrees")",
				selectInitVal: "@(Model.PKey)", // 你可以在这里指定默认值
				done: function (res, $ul, first) {
					if (first) {
						dtree.dataInit("PKey", "@(Model.PKey)");
					//    // 也可以在这里指定，第二个参数如果不填，则会自动返显当前选中的数据
					//    var selectParam = dtree.selectVal("PMId");
					}

				}
		});

	});
</script>
}
